package io.renren.modules.rpo.controller;

import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.rpo.entity.ResumeStatusEntity;
import io.renren.modules.rpo.service.ResumeStatusService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.common.utils.R;




/**
 * 简历状态定义
 * 
 * @author Zhaoyd
 * @email zhaoydjava@163.com
 * @date 2017-11-29 11:04:25
 */
@RestController
@RequestMapping("/rpo/resumestatus")
public class ResumeStatusController {
	@Autowired
	private ResumeStatusService resumeStatusService;
	
	/**
	 * 列表
	 */
	@RequestMapping("/list")
	@RequiresPermissions("rpo:resumestatus:list")
	public R list(@RequestParam Map<String, Object> params){
		//查询列表数据
        Query query = new Query(params);

		List<ResumeStatusEntity> resumeStatusList = resumeStatusService.queryList(query);
		int total = resumeStatusService.queryTotal(query);
		
		PageUtils pageUtil = new PageUtils(resumeStatusList, total, query.getLimit(), query.getPage());
		
		return R.ok().put("page", pageUtil);
	}
	
	
	/**
	 * 信息
	 */
	@RequestMapping("/info/{id}")
	@RequiresPermissions("rpo:resumestatus:info")
	public R info(@PathVariable("id") Integer id){
		ResumeStatusEntity resumeStatus = resumeStatusService.queryObject(id);
		
		return R.ok().put("resumeStatus", resumeStatus);
	}
	
	/**
	 * 保存
	 */
	@RequestMapping("/save")
	@RequiresPermissions("rpo:resumestatus:save")
	public R save(@RequestBody ResumeStatusEntity resumeStatus){
		resumeStatusService.save(resumeStatus);
		
		return R.ok();
	}
	
	/**
	 * 修改
	 */
	@RequestMapping("/update")
	@RequiresPermissions("rpo:resumestatus:update")
	public R update(@RequestBody ResumeStatusEntity resumeStatus){
		resumeStatusService.update(resumeStatus);
		
		return R.ok();
	}
	
	/**
	 * 删除
	 */
	@RequestMapping("/delete")
	@RequiresPermissions("rpo:resumestatus:delete")
	public R delete(@RequestBody Integer[] ids){
		resumeStatusService.deleteBatch(ids);
		
		return R.ok();
	}
	
}
